package edu.gdit.health.dao;

import edu.gdit.health.model.SysUser;
import org.apache.ibatis.annotations.*;
import edu.gdit.health.model.SysReport;
import edu.gdit.health.model.SysReportCount;

import java.util.List;
import java.util.Map;

@Mapper
public interface SysReportDao {
    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into sys_report(user_id, temperature, travel, remark, travel_description, physical_condition, createTime) " +
            "values(#{userId}, #{temperature}, #{travel}, #{remark}, #{travelDescription}, #{physicalCondition}, now())")
    int save(SysReport report);
    @Select("SELECT COUNT(*) as `value`,t.temperature as `name` from  sys_report t WHERE DATE_FORMAT(t.createTime, '%Y-%m-%d') >= #{startDateStr}  and DATE_FORMAT(t.createTime, '%Y-%m-%d') <= #{endDateStr} GROUP BY t.temperature")
    List<SysReportCount> getChartTemperatureData(@Param("startDateStr")String startDateStr, @Param("endDateStr")String endDateStr);
}

